﻿<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="MegaMenu.ascx.cs" Inherits="$rootnamespace$.Controls.MegaMenu" %>

<%@ Register TagPrefix="x" Namespace="$rootnamespace$.Controls" Assembly="$rootnamespace$" %>
<%@ Register TagPrefix="ow" Namespace="OpenWaves.Web.Controls" Assembly="OpenWaves.Web" %>

<%@ Import Namespace="OpenWaves" %>
<%@ Import Namespace="OpenWaves.Navigation" %>

<x:NavigationView runat="server" MaxNestingLevel="3" Model="<%# CreateModel() %>">
    
    <Template>
        <ul class="mega-menu">
            <ow:ChildNodesPlaceHolder runat="server" />
        </ul>
    </Template>
    
    <FirstLevelNodeTemplate>
        <li class="<%# Container.GetNodeStateClass() %>">

            <a href="#"><%# Html.Encode(Container.Node.Name) %></a>
        
            <div class="mega-sub-menu">
                <ow:Repeater runat="server" DataSource="<%# ((MegaMenuNode)Container.Node).Columns %>">
                    <ItemTemplate>
                        <ow:NodesPlaceHolder runat="server" DataSource="<%# Container.DataItem %>">
                            <ul>
                                <ow:ItemsPlaceHolder runat="server" />
                            </ul>
                        </ow:NodesPlaceHolder>
                    </ItemTemplate>
                </ow:Repeater>
            </div>
        </li>
    </FirstLevelNodeTemplate>
    
    <NodeTemplate>
        <li class="<%# Container.GetNodeStateClass() %>">

            <a href="<%# Container.Node.Url %>"><%# Html.Encode(Container.Node.Name) %></a>
        
            <ow:ChildNodesPlaceHolder runat="server">
                <ul>
                    <ow:ItemsPlaceHolder runat="server" />
                </ul>
            </ow:ChildNodesPlaceHolder>

        </li>
    </NodeTemplate>

</x:NavigationView>
